1. Field of the Invention
The present invention relates to applications running in client-server in general, and to a model and methods for constructing such applications in particular.
2. Discussion of the Related Art
The model-view-controller design pattern (MVC) is widely used in constructing applications. The MVC design pattern suggests separating an application into three layers: a model layer which provides a model of the data to be processed and manipulated, a view layer which provides presentation of the data, and a controller layer which coordinates the model and the view. When implementing an application under the object oriented methodology, an object is created which implements each of the three layers, thus receiving the basic functionality of each layer without further effort, so that only domain-specific and application-specific tasks have to be implemented. The model in the MVC design pattern is a domain-specific representation of the information on which the application operates. The model is preferably in communication with a persistent storage, such as a database storing the raw data of the application. The model adds an additional layer beyond the storage, which provides the meaning to the raw data, such as interpreting a first date as a birthday, and a second date as an account opening date. The view layer renders the model into a form suitable for interaction with a user, typically a user interface element. The controller layer processes and responds to events, typically user actions received through the user interface, and may invoke requests or changes on the model in response to the events. For example, web applications are often developed on the basis of the MVC design pattern. In web applications, the view is the code that renders the actual HTML page, the controller is the code that gathers dynamic data and generates the content within the HTML, and the model is represented by the actual content, represented as objects, the raw data of which is usually stored in a database, XML files or any other persistent storage. A typical control flow in an application constructed using the MVC design pattern is as follows: 1. The user interacts with the user interface. 2. The controller handles the input event from the user interface, for example via a registered handler or callback. 3. The controller accesses the model, possibly updating it. 4. One or more views offer a user interface while showing data from the model. Each view receives the data from the model. 5. The user interface is ready for further user interactions, which begin the cycle anew. One of the main advantages of the ARC pattern relates to the option of replacing any of the parts, such as the user interface or the storage (for example database) without affecting the other layers. Thus, it is possible, for example to upgrade any component while avoiding changes in the logic of the applications or other elements which are not replaced.
However, the MVC does not easily offer itself for use in client-server applications. It will be appreciated by a person skilled in the art that in such applications, that it is possible to locate the model, controller or view layers in either the server or one or more client platforms, and that each chosen location implies different implementation difficulties, technical challenges and user experience. Placing the controller and the view layer in the client platform, with which the user interacts, is generally considered good practice. However, placing and executing the model in either the client computing platform or the server computing platform poses significant difficulties. Placing and executing the model on the server platform harms the application's performance, since communication between the client and the server is required for each request or update. In addition, if connection to the server is lost, the application can not function. On the other hand, if the model is placed on the client platform, then various abstraction levels or services should be developed for the model, such as persistency, server abstraction, connectivity and others. As these abstraction level should be handled by the server platform, due to its connection to the storage, placing the model layer in the client platform results in duplicated abstraction layers. This may lead to suboptimal software construction. Additionally, placing the model in either the client or the server poses problems when the model is required to communicate with a multiplicity of servers.
There is thus a need in the art for a method that will enable the development of client-server applications, while maintaining the separation between the model, view and control layers. Such method should enable the development of efficient applications, which do not require intensive communication between the client and the server, while maintaining data integrity even while connection between the client and the server is not available. The method should further enable the construction of client-multi-server applications while offering the same advantages.